using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using FutureOpen.Web.Pages;
using FutureOpen.Core;
using FutureOpen.Core.func;
using FutureOpen.Core.func.util;
using FutureOpen.Core.func.db;
using FutureOpen.Core.func.sql;
using System.Text;
using System.Text.RegularExpressions;

public partial class test_Tags : PageBase
{
    
    private MyTagJob tagutil = new MyTagJob();
    protected void Page_Load(object sender, EventArgs e)
    {
        base.PageInit();
      
        if (!IsPostBack)
        {
            this.AspNetPager1.RecordCount = tagutil.GetTagCount();
            LoadTags(0, 20);
        }
    }

    private void LoadTags(int start, int count)
    {
        DataSet ds = TagProvider.GetTags(start, start + count);
        this.dlTags.DataSource = ds.Tables[0];
        this.dlTags.DataBind();
       
    }

    private string EncodeURL(string url, string title)
    {
        return StringUtil.EncodeNoDecURL(url, title);
    }
    
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        LoadTags((e.NewPageIndex - 1) * 20, 20);
    }

    public int GetLevel(Object p1, Object p2)
    {
        int day = Int32.Parse(p1.ToString());
        int week = Int32.Parse(p2.ToString());

        int avg = week / 7;
        if (day > 1.2 * avg)
        {
            return 2;
        }
        else if (day < 0.8 * avg)
        {
            return 1;
        }
        return 0;

    }

    public string EncodeText(object obj)
    {
        return HttpUtility.UrlEncode(obj.ToString());
    }
}


